<?php if (!defined('THINK_PATH')) exit();?>

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="/style/admin/style.css" />
<link rel="stylesheet" type="text/css" href="/javascript/home/webuploader/webuploader.css" />
<link rel="stylesheet" type="text/css" href="/kindeditor/skins/tinymce.css" />
    <script type="text/javascript">
 	var VAR_MODULE = "<?php echo conf("VAR_MODULE");?>";
	var VAR_ACTION = "<?php echo conf("VAR_ACTION");?>";
	var MODULE_NAME	=	'<?php echo MODULE_NAME; ?>';
	var ACTION_NAME	=	'<?php echo ACTION_NAME; ?>';
	var ROOT = '__APP__';
	var ROOT_PATH = '<?php echo APP_ROOT; ?>';
	var CURRENT_URL = '<?php echo trim($_SERVER['REQUEST_URI']);?>';
	var INPUT_KEY_PLEASE = "<?php echo (L("INPUT_KEY_PLEASE")); ?>";
	var TMPL = '__TMPL__';
	var APP_ROOT = '<?php echo APP_ROOT; ?>';
</script>
<script type="text/javascript" src="/javascript/home/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="/javascript/admin/jquery.timer.js"></script>
<script type="text/javascript" src="/javascript/admin/script.js"></script>
<script type="text/javascript" src="/javascript/admin/lang.js"></script>
<script type="text/javascript" src="/javascript/home/webuploader/webuploader.min.js"></script>
<script type="text/javascript" src="/kindeditor/kindeditor.js"></script>
<script type="text/javascript" src="/javascript/admin/calendar/WdatePicker.js"></script>
<script type="text/javascript" src="/javascript/admin/common.js"></script>
</head>
<body>
<div id="info"></div>

<script type="text/javascript" src="/javascript/admin/conf.js"></script>
<script type="text/javascript">
function memcache()
{
	var cache = $("select[name='CACHE_TYPE']").val();
	if(cache=='Memcached')
	$("input[name='MEMCACHE_HOST']").parent().parent().show();
	else
	$("input[name='MEMCACHE_HOST']").parent().parent().hide();
}
$(document).ready(function(){
	$("select[name='CACHE_TYPE']").bind("change",function(){
		memcache();
	});
	memcache();
});
</script>
<div class="main">
<div class="main_title"><?php echo ($main_title); ?></div>
<div class="blank5"></div>
<div class="button_row">
	<?php if(is_array($conf)): foreach($conf as $key=>$conf_group): ?><input type="button" class="button conf_btn" rel="<?php echo ($key); ?>" value="<?php echo l("CONF_GROUP_".$key);?>" />&nbsp;<?php endforeach; endif; ?>
</div>
<div class="blank5"></div>

<form name="edit" action="__APP__" method="post" enctype="multipart/form-data">
	<?php if(is_array($conf)): foreach($conf as $key=>$conf_group): ?><table class="form conf_tab" cellpadding=0 cellspacing=0 rel="<?php echo ($key); ?>">
		<tr>
			<td colspan=2 class="topTd"></td>
		</tr>
		<?php if(is_array($conf_group)): foreach($conf_group as $key=>$conf_item): ?><tr <?php if($conf_item['name'] == 'DB_VOL_MAXSIZE'): ?>style="display:none;"<?php endif; ?>>
			<td class="item_title"><?php echo l("CONF_".$conf_item['name']);?>:</td>
			<td class="item_input">
				<!--系统配置文本输入-->
				<?php if($conf_item['input_type'] == 0): ?><input type="text" class="textbox " name="<?php echo ($conf_item["name"]); ?>" value="<?php echo ($conf_item["value"]); ?>" /><?php endif; ?>
				<!--系统配置文本输入-->
				
				<!--系统配置密码框输入-->
				<?php if($conf_item['input_type'] == 4): ?><input type="password" class="textbox " name="<?php echo ($conf_item["name"]); ?>" value="<?php echo ($conf_item["value"]); ?>" /><?php endif; ?>
				<!--系统配置文本输入-->
				
				<!--系统配置下拉输入-->
				<?php if($conf_item['input_type'] == 1): ?><select name="<?php echo ($conf_item["name"]); ?>">
					<?php if(is_array($conf_item["value_scope"])): foreach($conf_item["value_scope"] as $key=>$preset_value): ?><option value="<?php echo ($preset_value); ?>" <?php if($conf_item['value'] == $preset_value): ?>selected="selected"<?php endif; ?>>
							<?php if($conf_item['name'] == 'TEMPLATE' or $conf_item['name'] == 'SHOP_LANG'): echo ($preset_value); else: echo l("CONF_".$conf_item['name']."_".$preset_value); endif; ?>
						</option><?php endforeach; endif; ?>
					</select><?php endif; ?>
				<!--系统配置下拉输入-->
				<!--系统配置图片输入-->
				<?php if($conf_item['input_type'] == 2): ?><script type="text/javascript">
    $(document).ready(function() {
        var <?php echo ($conf_item["name"]); ?>_uploader = WebUploader.create({
            auto: true,
            chunked: false,
            method: 'POST',
            disableGlobalDnd: true,
            fileNumLimit: 1,
            swf: '/javascript/home/webuploader/Uploader.swf',
            server: '/admin.php?m=File&a=flash_upload',
            pick: '#<?php echo ($conf_item["name"]); ?>_filePicker',
            accept: {
                title: '选择图片',
                extensions: 'gif,jpg,jpeg,png',
                mimeTypes: 'image/*'
            }
        });
        <?php echo ($conf_item["name"]); ?>_uploader.on('uploadSuccess', function (file,response) {
            var data = JSON.parse(response._raw);
            if(typeof(data.error) != 'undefined'){
                alert('上传错误');
            }else{
                $('#img_<?php echo ($conf_item["name"]); ?>').attr('src',data.result + '?rand='+Math.random());
                $('#<?php echo ($conf_item["name"]); ?>').val(data.result);
            }
            <?php echo ($conf_item["name"]); ?>_uploader.reset();
        });
    });
</script>
<div style='width:120px; height:40px; margin-left:10px; display:inline-block;  float:left;' class='none_border'><a id='<?php echo ($conf_item["name"]); ?>_filePicker' class='ke-icon' style='width:160px' title='上传图片'><span class='ke-common-icon ke-icon-upload_image'></span></a><input type='hidden' id='<?php echo ($conf_item["name"]); ?>' name='<?php echo ($conf_item["name"]); ?>' value='<?php echo ($conf_item["value"]); ?>' /><div id='<?php echo ($conf_item["name"]); ?>_fileList' class='uploader-list'></div></div><img src='$conf_item.value' onclick="openimg('<?php echo ($conf_item["name"]); ?>')" style='display:inline-block; float:left; cursor:pointer; margin-left:10px; border:#ccc solid 1px; width:35px; height:35px;' id='img_<?php echo ($conf_item["name"]); ?>' /><img src='/images/admin/del.gif' style='display:inline-block; margin-left:10px; float:left; border:#ccc solid 1px; width:35px; height:35px; cursor:pointer;' id='img_del_<?php echo ($conf_item["name"]); ?>' onclick='delimg("<?php echo ($conf_item["name"]); ?>")' title='删除' /><?php endif; ?>
				<!--系统配置图片输入-->
				<!--系统配置编辑器输入-->
				<?php if($conf_item['input_type'] == 3): ?><script type='text/javascript'> var eid = '<?php echo ($conf_item["name"]); ?>';KE.show({id : eid,skinType: 'tinymce',allowFileManager : true,resizeMode : 0,items : [
							'source','fullscreen', 'undo', 'redo', 'print', 'cut', 'copy', 'paste',
							'plainpaste', 'wordpaste', 'justifyleft', 'justifycenter', 'justifyright',
							'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
							'superscript', 'selectall', '-',
							'title', 'fontname', 'fontsize', 'textcolor', 'bgcolor', 'bold',
							'italic', 'underline', 'strikethrough', 'removeformat', 'image',
							'flash', 'media', 'table', 'hr', 'emoticons', 'link', 'unlink'
						]	});</script><div  style='margin-bottom:5px; '><textarea id='<?php echo ($conf_item["name"]); ?>' name='<?php echo ($conf_item["name"]); ?>' style=' height:150px;width:750px;' ><?php echo ($conf_item["value"]); ?></textarea> </div><?php endif; ?>
				<!--系统配置编辑器输入-->
			</td>
		</tr><?php endforeach; endif; ?>
		<tr>
			<td colspan=2 class="bottomTd"></td>
		</tr>
	</table><?php endforeach; endif; ?>	
	<div class="blank5"></div>
	<table class="form" cellpadding=0 cellspacing=0>
		<tr>
			<td colspan=2 class="topTd"></td>
		</tr>
		<tr>
			<td class="item_title"></td>
			<td class="item_input">
			<!--隐藏元素-->
			<input type="hidden" name="<?php echo conf("VAR_MODULE");?>" value="Conf" />
			<input type="hidden" name="<?php echo conf("VAR_ACTION");?>" value="update" />
			<!--隐藏元素-->
			<input type="submit" class="button" value="<?php echo (L("EDIT")); ?>" />
			<input type="reset" class="button" value="<?php echo (L("RESET")); ?>" />
			</td>
		</tr>
		<tr>
			<td colspan=2 class="bottomTd"></td>
		</tr>
	</table> 
</form>
<div class="blank5"></div>
</div>
</body>
</html>